/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Language:  C++
Date:      $Date: 2010-03-31 22:40:27 +0800 (周三, 31 三月 2010) $
Version:   $Revision: 21975 $ 
 
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef WxLiverAnalysisView_h
#define WxLiverAnalysisView_h

#include <berryISelectionListener.h>

#include <QmitkFunctionality.h>

#include "ui_WxLiverAnalysisViewControls.h"


#include "vtkIdList.h"

#include "vtkPolyData.h"

#include <mitkDataStorageSelection.h>

#include "mitkPointSet.h"

#include "mitkPointSetInteractor.h"

#include "vtkvmtkCenterlineBranchExtractor.h"
#include <itkImage.h>
/*!
  \brief WxLiverAnalysisView 

  \warning  This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.

  \sa QmitkFunctionality
  \ingroup Functionalities
*/
class WxLiverAnalysisView : public QObject, public QmitkFunctionality
{  
  // this is needed for all Qt objects that should have a Qt meta-object
  // (everything that derives from QObject and wants to have signal/slots)
  Q_OBJECT
  
  public:  

    static const std::string VIEW_ID;

    WxLiverAnalysisView();
    virtual ~WxLiverAnalysisView();

    virtual void CreateQtPartControl(QWidget *parent);

    virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
    virtual void StdMultiWidgetNotAvailable();
    virtual void Deactivated();
  protected slots:
  
    /// \brief Called when the user clicks the GUI button
    void DoImageProcessing();
    void DoVesselRe();
    vtkImageData* ExecuteFM(vtkImageData* image,double lowerThreshold,double higherThreshold,vtkIdList*  sourceSeedIds,vtkIdList*targetSeedIds);
    vtkPolyData* MarchingCubes(vtkImageData* image,double threshold);
    vtkPolyData* computeCenterlines(vtkPolyData* CenterIndata,vtkIdList*  inletSeedIds,vtkIdList*  outletSeedIds );
    void Updataimge(vtkImageData* image);
    void acseg();
  protected:

    /// \brief called by QmitkFunctionality when DataManager's selection has changed
    virtual void OnSelectionChanged( std::vector<mitk::DataNode*> nodes );

    template < typename TPixel, unsigned int VImageDimension >
    void ItkImageProcessing( itk::Image< TPixel, VImageDimension >* itkImage, mitk::Geometry3D* imageGeometry, mitk::DataNode* parent );


    mitk::DataStorageSelection::Pointer m_SelectedImageNode;

    mitk::DataStorageSelection::Pointer m_SelectedsurfaceeNode;

    mitk::DataNode::Pointer m_SourcePointSetNode;

    mitk::PointSet::Pointer m_SourcePointSet;

    mitk::DataNode::Pointer m_SourcePointSetNode_re;

    mitk::PointSet::Pointer m_SourcePointSet_re;


    mitk::DataNode::Pointer m_TargetPointSetNode_re;

    mitk::PointSet::Pointer m_TargetPointSet_re;

    bool mask;

    mitk::DataNode::Pointer newNode;

    Ui::WxLiverAnalysisViewControls* m_Controls;

    QmitkStdMultiWidget* m_MultiWidget;
};



#endif // _WXLIVERANALYSISVIEW_H_INCLUDED

